﻿// Author: Hristo Hristov
// Date: 18.08.11
// Revision 5

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NOVA.Physics
{
    /// <summary>
    /// This class represents the motion setting parameters, which specify 
    /// the limits of the MotorizedGrabSpring for every scene object.
    /// </summary>
    public class MotionSetting
    {
        public float LinearStiffness { get; set; }
        public float LinearDamping { get; set; }
        public float MaxLinearAcceleration { get; set; }
        public float AngularStiffness { get; set; }
        public float AngularDamping { get; set; }
        public float MaxAngularAcceleration { get; set; }
        public float LinearVelocityThreshold { get; set; }
        public float AngularVelocityThreshold { get; set; }
        public float LinearPositionThreshold { get; set; }
        public float AngularPositionThreshold { get; set; }

        public MotionSetting()
        {
            LinearPositionThreshold = 0.2f;
            LinearVelocityThreshold = 0.1f;

            AngularPositionThreshold = 0.2f;
            AngularVelocityThreshold = 0.1f;
        }

        /// <summary>
        /// Creates an instance of a hard setting
        /// </summary>
        public static MotionSetting HardSetting
        {
            get 
            {
                MotionSetting setting = new MotionSetting();

                // Linear settings
                setting.LinearStiffness = 100000f;
                setting.LinearDamping = 10000f;
                setting.MaxLinearAcceleration = 10000f;

                // Angular settings
                setting.AngularStiffness = 60000f;
                setting.AngularDamping = 10000f;
                setting.MaxAngularAcceleration = 1000f;

                

                return setting;
            }
        }

        /// <summary>
        /// Creates an instance of a soft setting
        /// </summary>
        public static MotionSetting SoftSetting
        {
            get
            {
                MotionSetting setting = new MotionSetting();

                // Linear settings
                setting.LinearStiffness = 1000f;
                setting.LinearDamping = 10f;
                setting.MaxLinearAcceleration = 100f;

                // Angular settings
                setting.AngularStiffness = 0.1f;
                setting.AngularDamping = 0.1f;
                setting.MaxAngularAcceleration = 100f;

                return setting;
            }
        }
    }
}
